<?php
namespace app\test\controller;
use think\Db;
use think\Controller;
class Order extends Controller
{
    public function index()
    {
    	$shopcart_id=$_POST['productId'];
    	$order_total=$_POST['orderTotal'];
    	dump($order_total);
    	dump($shopcart_id);
    	
    	//$num = explode("\n", $_POST['productId']);
        //var_dump($num);
    	
    	$data=[
    		'shopcart_id'=>$shopcart_id,
    		'order_total'=>$order_total,
    		'order_time'=>time()
    	];

    	$result=db('dachang_order')->insert($data);
    	if($result==false)
         {
         
          $this->error("插入失败");
         }
         
          $this->success('插入成功',url('Confirmorder/index',['shopcart_id'=>$shopcart_id,'order_total'=>$order_total])); 
        
        
        
    	
    }
    public function ajax()
    {
    	
    	$total=$_POST['cc'];
    	
    	

    	/*$product_price=db('dachang_product')->where('product_id={$product_id}')->field('product_price')->select();

        $total=$count*$product_price;*/
    	echo $total;
    }
 }